Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
how to implement or improve a "killfile" for stack exchange?

SE doesn't have any killfile capability to hide posts by trolls and other abusive people. And, unfortunately, blocking such trolls can't be done with CSS hacks alone (because there's nothing in the CSS which distinguishes a troll from a normal person). Blocking trolls need to be done by matching their usernames in the actual text of the post or comment, so it requires javascript and a userscript manager like grease/tamper/violent-monkey.

I've come up with the following (based on the same code I've used for other sites to hide advertorial garbage hiding amongst actual articles - no obvious CSS differences, but with identifiable author By-Lines), which mostly works but it doesn't interact perfectly with posts that have lots of comments - it breaks the "Show more comments" link. Not a huge problem, but I'd rather it didn't do that.

Update: Actually, it breaks the "Show more" link no matter how many comments there are, a bigger problem than I thought.

Does anyone have any idea what's causing it to do that, or how to fix it? Is it the div class for comments div.comment-text.js-comment-text-and-form that I'm targeting?

// ==UserScript==
// @name         Killfile Userscript for Stack Exchange
// @namespace    MonkeyScripts
// @version      0.1
// @description  Hide posts by abusive/irritating users
// @author       cas
// @match        https://*.stackexchange.com/*
// @match        https://*.stackoverflow.com/*
// @match        https://*.serverfault.com/*
// @match        https://*.superuser.com/*
// @match        https://*.askubuntu.com/*
// @require      https://code.jquery.com/jquery-2.1.0.min.js
// @grant        none
// ==/UserScript==

// hide posts and comments by particular authors

(function() {
      let Trolls = ['Ned Trollton','Angry Stalker','loser12345'];

      let elements = ['li.comment',
                      'div.answercell.post-layout--right',
                      'div.postcell.post-layout--right'];

      for (let i = 0; i < Trolls.length; i++) {
          for (let j = 0; j < elements.length; j++) {
              $(elements[j] + ":contains(" + Trolls[i] + ")").hide();
          }
    }
})();
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda